import { CoolController, BaseController } from "@cool-midway/core";
import { ProviderTeamJoinEntity } from "../../entity/join";
import { ProviderProfileEntity } from "../../entity/profile";
import { ProviderTeamEntity } from "../../entity/team";

/**
 * 团队加入申请记录
 */
@CoolController({
    api: ['delete', 'list', 'page'],
    entity: ProviderTeamJoinEntity,
    pageQueryOp: {
        // 关联查询
        select: ['a.*', 'b.name as providerName', 'c.name as teamName'],
        join: [
            {
                entity: ProviderProfileEntity,
                alias: 'b',
                condition: 'a.providerId = b.providerId',
                type: 'leftJoin'
            },
            {
                entity: ProviderTeamEntity,
                alias: 'c',
                condition: 'a.teamId = c.id',
                type: 'leftJoin'
            }
        ],
        // 筛选
        fieldEq: ['a.status', 'a.teamId', 'a.providerId']
    }
})
export class AdminProviderTeamJoinController extends BaseController { }

